import request from '@/utils/request';
import Constants from '@/utils/constants';

export async function queryPageGroupList(params?: any, options?: { [key: string]: any }) {
  return request<API.BaseRes>(`${Constants.SERVICE_ROOT}/sys-group/list`, {
    method: 'GET',
    params: params ?? {},
    ...(options || {}),
  });
}

export async function queryAuthList(params?: any, options?: { [key: string]: any }) {
  return request<API.BaseRes>(`${Constants.SERVICE_ROOT}/sys-auth/list`, {
    method: 'GET',
    params: params ?? {},
    ...(options || {}),
  });
}


export async function addGroup(params: any) {
  return request<API.BaseRes>(`${Constants.SERVICE_ROOT}/sys-group/info`, {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

export async function updateGroup(params: any) {
  return request<API.BaseRes>(`${Constants.SERVICE_ROOT}/sys-group/info`, {
    method: 'PUT',
    data: {
      ...params,
    },
  });
}

export async function groupDetail(params: any) {
  return request<API.BaseRes>(`${Constants.SERVICE_ROOT}/sys-group/info`, {
    method: 'GET',
    params: {
      ...params,
    },
  });
}

export async function removeGroup(params: any) {
  return request<API.BaseRes>(`${Constants.SERVICE_ROOT}/sys-group/info`, {
    method: 'DELETE',
    data: {
      ...params,
    },
  });
}
